package com.sf.demo.controller;

import com.sf.demo.service.UserService;
import com.sf.framework.annotaction.SFAutowrite;
import com.sf.framework.annotaction.SFController;
import com.sf.framework.annotaction.SFRequestMapping;
import com.sf.framework.annotaction.SFRequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


@SFController
@SFRequestMapping(value = "/demo")
public class TestController {

    @SFAutowrite
    private UserService userService;


    @SFRequestMapping(value = "/query")
    public void query(HttpServletRequest request, HttpServletResponse response, @SFRequestParam(value = "name") String name){
        name = userService.getUserName()+name;
        try {
            response.getWriter().write(name);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
